<template>
  <h2 v-show="person.name">姓名:{{ person.name }}</h2>
  <h2>年龄:{{ person.age }}</h2>
  <slot></slot>
  <button @click="test">测试事件</button>
</template>

<script>
import { reactive } from "vue";
export default {
  name: "Demo",
  beforeCreate() {},
  props:['school'],
  emits:['hello'],
  setup(props,context) {
    // console.log('setup',props);
    // console.log('setup',context.attrs);
    // console.log('setup',context.emit);
    // console.log('setup',context.slots);
    let person = reactive({
      name: "张三",
      age: 18,
    });
    function test(){
        context.emit('hello','杨潇')
    }
    return {
      person,test,
    };
  },
};
</script>